<!doctype html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>易测环境后台管理</title>
    <link th:href="@{css/login/zui.css}"  rel="stylesheet">
    <link th:href="@{css/login/login.css}"  rel="stylesheet" media="all">
    <link th:href="@{css/login/animate.min.css}"  rel="stylesheet">
    <link th:href="@{css/login/font-awesome.min.css}" rel="stylesheet">
    <link th:href="@{/css/sweetalert/sweetalert.css}" rel="stylesheet">
    <style> body { background-image: url(images/4.jpg);}</style>
</head>
<body>
<div id="main-box"></div>
<div id="main-content">
    <div class="login-body  animated fadeInLeft">
        <div class="login-main pr">
            <form action="javascript:show();" method="post" class="login-form">
                <h3> 易测环境后台管理 </h3>
                <h5 style="padding-bottom: 10px">Backstage management of easy to measure environment </h5>
                <!-- 账号登陆 -->
                <div id="MobileBox" class="item-box"  >
                    <div class="input-group user-name"> <span class="input-group-addon"><i class="icon-user"></i></span>
                        <input type="text" name="userId" id="userId" class="form-control" placeholder="用户名/手机号" />
                    </div>
                    <div class="input-group password"> <span class="input-group-addon"><i class="icon-lock"></i></span>
                        <input type="password" name="passWord" id="passWord" class="form-control" placeholder="密码">
                    </div>
                    <div class="login_btn_panel">
                        <button class=" btn btn-primary btn-block btn-lg" data-ajax="post" type="submit" data-callback="success">登录</button>
                        <div class="check-tips"></div>
                    </div>
                    </div>
            </form>
        </div>
    </div>
</div>
<script th:src="@{/js/plugins/sweetalert/sweetalert.min.js}"></script>
<script th:src="@{/js/jquery.min.js?v=2.1.4}"></script>
<script>
    var fromurl = "/login.do";
    function show() {
        var userId = $("#userId").val();
        var passWord = $("#passWord").val();
        console.log(userId);
        console.log(passWord);
        if ($.trim(userId) == "") {
            swal("用户名不为空");
            return;
        }
        if ($.trim(passWord) == "") {
            swal("密码不为空");
            return;
        }
        $.ajax({
            type : 'post',
            url : '/loginCheck.do',
            data : {
                "userId" : userId,
                "passWord" : passWord
            },
            success : function(data) {
                if (data.status == 10001) {
                    if (fromurl == "")
                        self.location = document.referrer;//返回上一页并刷新！
                    else
                        self.location = fromurl;
                } else {
                    swal("用户名或密码错误");
                }
            }
        });
    }
</script>
</body>
</html>
